package com.hqyj.controller;


import com.hqyj.exception.R;
import com.hqyj.pojo.OrderInfoParameter;
import com.hqyj.pojo.PayParameter;
import com.hqyj.service.AliPayService;
import com.hqyj.service.OrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author rock
 * @since 2023-01-28 09:21:30
 */
@RestController
@RequestMapping("/order-info")
public class OrderInfoController {

    @Autowired
    OrderInfoService orderInfoService;
    @Autowired
    AliPayService aliPayService;
    //付款
    @PostMapping("/order")
    public R addOrder(@RequestBody PayParameter payParameter){

        return aliPayService.tranPay(payParameter);
    }
    //查询买家的订单
    @GetMapping("/order")
    public  R queryOrder(HttpServletRequest request){
        return orderInfoService.queryOrder(request);
    }
    //修改订单支付状态
    @PutMapping("/order")
    private R updateOrder(String num){
        return orderInfoService.updatePayStatus(num);
    }


}

